In [35]:
%matplotlib inline

import matplotlib.pyplot as plt
import plotly
plotly.offline.init_notebook_mode()
import os
import numpy as np
from scipy.io import wavfile
import plotly.graph_objs as go
from plotly.offline import iplot
import random
from os import listdir
from os.path import isfile, join
import subprocess
from plotly import tools
import plotly.plotly as py
In [2]:
mypath = 'validation'
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
random.shuffle(onlyfiles)
In [12]:
subprocess.call(["python", "generate.py", '--wav_out_path=conditionedSamples/generated_1.wav', '--samples', '9000', '--wav_seed=validation/A05088.wav', 'logdir_normal_nosilence/train/Checkpoint/model.ckpt-19999'])
Out[12]:
0
In [3]:
myFiles = onlyfiles[:10]
In [4]:
data = wavfile.read('validation/'+myFiles[0])[1]
In [5]:
for x in myFiles: 
    data = wavfile.read('validation/'+x)[1]
    iplot([go.Scatter(x=np.arange(len(data))/300.0, y=data)])
In [14]:
for x in myFiles:
    subprocess.call(["python", "generate.py", '--wav_out_path=conditionedSamples/generated'+x, '--samples', '9000', '--wav_seed=validation/'+x, 'logdir_normal_nosilence/train/Checkpoint/model.ckpt-19999'])
    rate,data = wavfile.read('conditionedSamples/generated'+x)
    iplot([go.Scatter(x=np.arange(len(data))/300.0, y=data)])
In [11]:
myFiles
Out[11]:
['A05088.wav',
 'A02768.wav',
 'A07805.wav',
 'A02377.wav',
 'A04139.wav',
 'A08264.wav',
 'A05173.wav',
 'A00403.wav',
 'A02156.wav',
 'A05543.wav']
In [37]:
i = 0
for x in myFiles:
    rate,data = wavfile.read('conditionedSamples/generated'+x)
    original = data[0:8000]
    rest = data[8000:]
    org = go.Scatter(x=np.arange(len(original))/300.0, y=np.abs(np.fft.fft(original)))
    gen = go.Scatter(x=np.arange(len(rest))/300.0, y=np.abs(np.fft.fft(rest)))
    fig = tools.make_subplots(rows=1, cols=2)

    fig.append_trace(org, 1, 1)
    fig.append_trace(gen, 1, 2)
    iplot(fig)
This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]

This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]

This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]

This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]

This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]

This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]

This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]

This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]

This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]

This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]

In [38]:
for x in myFiles:
    rate,data = wavfile.read('conditionedSamples/generated'+x)
    original = data[0:8000]
    rest = data[8000:]
    orgmean = np.mean(original)
    orgrest = np.mean(rest)
    print("Mean of the original sample for file " + x + " was ", orgmean, "while for the generated portion it was ", orgrest)
Mean of the original sample for file A05088.wav was  0.0349585 while for the generated portion it was  0.0123198
Mean of the original sample for file A02768.wav was  0.0128814 while for the generated portion it was  0.00338061
Mean of the original sample for file A07805.wav was  0.00835343 while for the generated portion it was  0.0053214
Mean of the original sample for file A02377.wav was  0.0058518 while for the generated portion it was  0.0100477
Mean of the original sample for file A04139.wav was  0.00490405 while for the generated portion it was  0.00308338
Mean of the original sample for file A08264.wav was  0.00275863 while for the generated portion it was  -0.00980807
Mean of the original sample for file A05173.wav was  0.000766227 while for the generated portion it was  0.0239162
Mean of the original sample for file A00403.wav was  -0.0089501 while for the generated portion it was  -0.0140918
Mean of the original sample for file A02156.wav was  0.0197336 while for the generated portion it was  0.0203787
Mean of the original sample for file A05543.wav was  0.0265797 while for the generated portion it was  0.0219349
In [ ]: